package project.gc.com.myapplication.glide;

import android.content.Context;

import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.Registry;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;


/**
 * Created by dizner on 2018/1/8.
 */

@GlideModule
public class EduGlideMode extends AppGlideModule {
    private static final int GLIDE_DISK_CACHE_SIZE = 250 * 1024 * 1024;
    private static final int GLIDE_MEMORY_CACHE_SIZE = 30 * 1024 * 1024;

    @Override
    public void applyOptions(Context context, GlideBuilder builder) {
        super.applyOptions(context, builder);
//        ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
//        int memClass = activityManager.getMemoryClass() / 8;//64，以m为单位
//        builder.setMemoryCache(new LruResourceCache(memClass));
//        builder.setBitmapPool(new LruBitmapPool(memClass));
//        builder.setArrayPool(new LruArrayPool(memClass));
    }

    @Override
    public void registerComponents(Context context, Glide glide, Registry registry) {
        super.registerComponents(context, glide, registry);
    }

    @Override
    public boolean isManifestParsingEnabled() {
        return false;
    }
}